package cn.zcy.linstner;

import cn.zcy.event.MyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 * 自定义监听器
 */
@Component
public class MyLinstner2 implements ApplicationListener<MyEvent> {
    //ContextRefreshedEvent Spring内置事件，容器启动完成后发布，可以用于容器启动后的一些扩展
    @Override
    public void onApplicationEvent(MyEvent event) {
        if (event.getName().equals("spring")){

            System.out.println("spring");
        }
    }
}
